package com.ruoyi.project.sysmanage.service.impl;

import com.ruoyi.project.sysmanage.domain.Cost;
import com.ruoyi.project.sysmanage.mapper.CostMapper;
import com.ruoyi.project.sysmanage.service.CostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author : 代学欣
 * @date : 21:31 2021/7/13
 */
@Service
public class CostServiceImpl implements CostService {
    @Autowired
    private CostMapper costMapper;

    /**
     * 查询检查费用
     * @param cost
     * @return
     */
    @Override
    public List<Cost> selectList(Cost cost) {
        List<Cost> list = costMapper.selectList(cost);
        return list;
    }

    /**
     * 添加检查费用
     * @param cost  添加参数
     * @return
     */
    @Override
    public int addCost(Cost cost) {
        //添加创建时间
        cost.setCreateTime(new Date());
        return costMapper.insertOne(cost);
    }

    @Override
    public Cost getById(Integer item_id) {
        return costMapper.selectOne(item_id);
    }

    @Override
    public int updateCost(Cost cost) {
        cost.setUpdateTime(new Date());
        return costMapper.update(cost);
    }

    @Override
    public int deleteCost(Integer[] item_ids) {
        return costMapper.batchdelete(item_ids);
    }
}
